#!/usr/bin/python3
# -* - coding: UTF-8 -* -
from cookieUtils import CookieManager
from data import Config
from selenium_utils.Apgar import Apgar
from utils import Support, LogSys

def open_url(driver, request, openUrl, user, cookies, loginWebUrl, app):
    '''
    登录并插入cookie，然后打开目标url
    :param driver:
    :param loginUrl:
    :param openUrl:
    :param user:
    :return:
    '''
    driver.get(loginWebUrl)
    Support.sleep(1)
    if app == Config.APP_YLT:
        CookieManager.set_cookie_for_ylt(driver, user)
    Support.sleep(5)
    driver.get(openUrl)
    driver.refresh()
    Support.sleep(5)


def just_open_url(driver,openUrl):
    driver.get(openUrl)
    Support.sleep(1)
